package com.itlong.cloud.app.resource;

import com.itlong.cloud.POJO.DTO.app.AppMonthCarBillDTO;
import com.itlong.cloud.POJO.DTO.app.AppMonthCardFeeRecordPageDTO;
import com.itlong.cloud.POJO.VO.app.AppMonthCardBillVO;
import com.itlong.cloud.POJO.VO.app.AppMonthCardFeeRecordVO;
import com.itlong.cloud.POJO.VO.app.AppMonthCardParkingVO;
import com.itlong.cloud.POJO.VO.miniprogram.WeChatOfficialGetMonthCardCarVO;
import com.itlong.cloud.app.service.IAppMonthCardParkingService;
import com.itlong.cloud.project.app.IAppMonthCardParkingServiceClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <desc>
 *      APP-月卡停车模块暴露接口实现类.
 * </desc>
 *
 * @createDate 2018/11/6
 */
@RestController
public class AppMonthCardParkingServiceResource implements IAppMonthCardParkingServiceClient {

    @Autowired
    IAppMonthCardParkingService iAppMonthCardParkingService;

    /**
     * <desc>
     *      获取月卡车辆列表
     * </desc>
     *
     * @param userId
     * @return 月卡车辆列表信息
     * @author Juguang.S
     * @createDate 2018/11/06
     */
    @Override
    @RequestMapping(path = "/app/project/getMonthCarList",method = RequestMethod.POST)
    public List<AppMonthCardParkingVO> getMonthCarList(@RequestParam("userId") String userId)  throws Exception {
        return iAppMonthCardParkingService.getMonthCarList(userId);
    }

    /**
     * <desc>
     *      获取当前用户是否是月卡用户
     * </desc>
     *
     * @param userId
     * @return
     * @author Juguang.S
     * @createDate 2018/11/06
     */
    @Override
    @RequestMapping(path = "/app/project/getUserIsParkVIP",method = RequestMethod.POST)
    public Integer getUserIsParkVIP(@RequestParam("userId") String userId)  throws Exception {
        return iAppMonthCardParkingService.getUserIsParkVIP(userId);
    }

    /**
     * <desc>
     *      生成月卡车辆缴费账单
     * </desc>
     *
     * @param  appMonthCarBillDTO 生成账单所需参数
     * @return 缴费账单信息数据
     * @author Juguang.S
     * @createDate 2018/11/07
     */
    @Override
    @RequestMapping(path = "/app/project/monCarFeeBill",method = RequestMethod.POST)
    public AppMonthCardBillVO monCarFeeBill(@RequestBody AppMonthCarBillDTO appMonthCarBillDTO) throws Exception {
        return iAppMonthCardParkingService.monCarFeeBill(appMonthCarBillDTO);
    }

    /**
     * <desc>
     *      获取当前用户下月卡车辆缴费账单列表
     * </desc>
     *
     * @param recordPageDTO 获取账单所需参数
     * @return 缴费记录
     * @author Juguang.S
     * @createDate 2018/11/08
     */
    @Override
    @RequestMapping(path = "/app/project/getMonPayListPage",method = RequestMethod.POST)
    public List<AppMonthCardFeeRecordVO> getMonPayListPage(@RequestBody AppMonthCardFeeRecordPageDTO recordPageDTO) throws Exception {
        return iAppMonthCardParkingService.getMonPayListPage(recordPageDTO);
    }

    /**
     * <desc>
     *      处理零元支付情况
     * </desc>
     *
     * @param billId 账单ID
     * @return 缴费记录
     * @author Juguang.S
     * @createDate 2018/11/15
     */
    @RequestMapping(path = "/app/project/noticeZeroPayment",method = RequestMethod.POST)
    public void noticeZeroPayment(@RequestParam("billId") String billId) throws Exception{
        iAppMonthCardParkingService.noticeZeroPayment(billId);
    }

    /**
     * <desc>
     *      微信公众号获取月卡车辆列表
     * </desc>
     *
     * @param plateNumber
     * @return 月卡车辆列表
     * @author wangzhi
     * @createDate 2019/04/01
     */
    @Override
    @PostMapping(path = "/weChatOfficial/parking/getMonthCardCarList")
    public List<WeChatOfficialGetMonthCardCarVO> getMonthCardCarList(@RequestParam("plateNumber") String plateNumber) throws Exception {
        return iAppMonthCardParkingService.getMonthCardCarList(plateNumber);
    }
}